const int MX = 1000;
int f[MX + 1];

auto init = [] {
    for (int i = 1; i <= MX; i++) {
        f[i] = INT_MAX;
        for (int j = 1; j <= i; j++) {
            f[i] = min(f[i], max(j, f[i - j] + 1));
        }
    }
    return 0;
    }();

    class Solution {
    public:
        int twoEggDrop(int n) {
            return f[n];
        }
    };